package com.lijie.ljblog.controller;

import com.github.pagehelper.PageInfo;
import com.lijie.ljblog.model.Music;
import com.lijie.ljblog.model.dto.MusicDTO;
import com.lijie.ljblog.service.MusicService;
import com.lijie.ljblog.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Authorr 李杰
 * @Date：2023/1/1215:27
 **/
@RestController
@RequestMapping("/music")
public class MusicController {

    @Resource
    MusicService musicService;


    @GetMapping("/randomList")
    public Result<List<Music>> randomList(){

        return musicService.getRandomMusicList();

    }
    @PostMapping("/musicList")
    public Result<PageInfo<Music>> musicList(@RequestBody MusicDTO musicDTO){

        return Result.ok(musicService.musicListPage(musicDTO));

    }
}
